package com.eu.ebpm.engine.task;

import java.util.HashMap;
import java.util.Map;

import com.eu.ebpm.engine.service.Task;

/**
 * 
 * 类名称: DelegateTask
 * 类描述: 委派任务，用于serviceTask
 * @author 王晓华
 * @since 2013-12-25 上午10:29:18
 * @version v1.0
 */
public class DelegateTask {

	private Task task;
	
	private Map<String, Object> previousVariables;
	
	private Map<String, Object> variables;

	public DelegateTask(){}
	
	public DelegateTask(Task task, Map<String, Object> previousVariables) {
		this.task = task;
		this.previousVariables = previousVariables;
	}

	public Task getTask() {
		return task;
	}

	public void setTask(Task task) {
		this.task = task;
	}

	public Map<String, Object> getPreviousVariables() {
		return previousVariables;
	}
	
	public Object getPreviousVariable(String key) {
		return previousVariables.get(key);
	}

	public void setVariable(String key, Object value) {
		if(this.variables == null) {
			this.variables = new HashMap<String, Object>();
		}
		this.variables.put(key, value);
	}

	public Map<String, Object> getVariables() {
		return variables;
	}

	@Override
	public String toString() {
		return "DelegateTask [task=" + task + ", previousVariables=" + previousVariables + ", variables=" + variables + "]";
	}
	
}
